/*
 * 实时任务操作模块测试代码
 *
 */

#include "usbctrl.h"
#include "../include/uptaskr.h"
#include "../include/upcmd.h"

int
main(int argc,char **argv)
{

	initutr();
	//printf("初始化完毕\n");
	if(fork() == 0){
		int	i = 0;
		struct upcmd newcmd;
		memset(&newcmd,0,sizeof(struct upcmd));
		while(1){
			newcmd.confd	= i;
			newcmd.ip	= i;
			newcmd.stat	= i;
			//newcmd.etime	= 1;
			if(addutr(newcmd)<0){
			  printf("添加任务失败\n");
			  continue;
			}
			i++;
			sleep(1);
		}		
	}
	
	struct upcmd cmd;
	while(1){
	  //	printf("等待接收任务\n");
		getutr(&cmd);
		printf("%d\n",cmd.confd);
	}
	return 0;	
}
